local zuixiang = fk.CreateSkill{
  name = "sj3__zuixiang",
  tags = { Skill.Limited },
}

Fk:loadTranslationTable{
  ["sj3__zuixiang"] = "醉乡",
  [":sj3__zuixiang"] = "<b>限定技</b>，出牌阶段或当你处于濒死状态时， 你可以用所有手牌交换弃牌堆中所有【酒】。",

  ["#sj3__zuixiang"] = "醉乡：你可以用所有手牌交换弃牌堆中所有【酒】",

  ["$sj3__zuixiang1"] = "懵懵醉乡中，天下心中藏。",
  ["$sj3__zuixiang2"] = "今朝有酒，管甚案牍俗事。",
}

zuixiang:addEffect("active", {
  anim_type = "defensive",
  prompt = "#sj3__zuixiang",
  card_num = 0,
  target_num = 0,
  can_use = function(self, player)
    return player:usedSkillTimes(zuixiang.name, Player.HistoryGame) == 0 and not player:isKongcheng() and 
    table.find(Fk:currentRoom().discard_pile,function (id)
      return Fk:getCardById(id).name == "analeptic"
    end)
  end,
  card_filter = Util.FalseFunc,
  on_use = function(self, room, effect)
    local player = effect.from
    local cards = table.filter(Fk:currentRoom().discard_pile,function (id)
      return Fk:getCardById(id).name == "analeptic"
    end)
    room:swapCardsWithPile(player,player:getCardIds("h"),cards,zuixiang.name,"discardPile",true,player)
  end,
})
zuixiang:addEffect(fk.AskForPeaches, {
  mute = true,
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(zuixiang.name) and player.dying and
      player:usedSkillTimes(zuixiang.name, Player.HistoryGame) == 0 and not player:isKongcheng()
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    player:broadcastSkillInvoke(zuixiang.name)
    room:notifySkillInvoked(player, zuixiang.name, "support")
    Fk.skills[zuixiang.name]:onUse(room, {
      from = player,
    })
  end,
})

return zuixiang
